package com.shop.shoporder.service.impl;


import com.shop.shoporder.entity.order.UserAddress;
import com.shop.shoporder.mapper.order.UserAddressMapper;
import com.shop.shoporder.service.UserAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service("userAddressService")
public class UserAddressServiceImpl implements UserAddressService {

    @Autowired
    UserAddressMapper userAddressMapper;


    @Transactional
    @Override
    public int deleteByPrimaryKey(Integer id) throws Exception {
        return userAddressMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(UserAddress record) throws Exception {
        return userAddressMapper.insert(record);
    }
    @Transactional
    @Override
    public int insertSelective(UserAddress record) throws Exception {
        return userAddressMapper.insertSelective(record);
    }

    @Override
    public UserAddress selectByPrimaryKey(Integer id) throws Exception {
        return userAddressMapper.selectByPrimaryKey(id);
    }
    @Transactional
    @Override
    public int updateByPrimaryKeySelective(UserAddress record) throws Exception {
        return userAddressMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(UserAddress record) throws Exception {
        return userAddressMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<UserAddress> getAddressList(int userNoId) throws Exception {
        return userAddressMapper.getAddressList(userNoId);
    }

    @Override
    public UserAddress getAddressDefault(Integer userNoId) {
        return userAddressMapper.getAddressDefault(userNoId);
    }

    @Override
    public int updateIsDelete(Integer id) {
        return userAddressMapper.updateIsDelete(id);
    }

    @Override
    public UserAddress getAddressAll(UserAddress userAddress) {
        return userAddressMapper.getAddressAll(userAddress);
    }

    @Override
    public int updateAddressStateByUserId(Integer userNoId) {
        return userAddressMapper.updateAddressStateByUserId(userNoId);
    }
}
